import http from "@/common/http/request";
import {
  systemRoleListInterface,
  systemRoleAddInterface,
  systemRoleUpdateInterface,
  systemRoleChangeStatusInterface,
} from "./role.interface";
// 角色列表
export const $systemRoleList = (data: systemRoleListInterface) => {
  const $http = new http();
  return $http.get({
    url: '/system/role/list',
    data,
  })
}

// 角色详情
export const $systemRoleDetail = (roleId: number) => {
  const $http = new http();
  return $http.get({
    url: `/system/role/${roleId}`,
  })
}

// 新增角色
export const $systemRoleAdd = (data: systemRoleAddInterface) => {
  const $http = new http();
  return $http.post({
    url: '/system/role',
    data,
  })
}

// 修改角色
export const $systemRoleUpdate = (data: systemRoleUpdateInterface) => {
  const $http = new http();
  return $http.put({
    url: '/system/role',
    data,
  })
}

// 角色状态修改
export const $systemRoleChangeStatus = (data: systemRoleChangeStatusInterface) => {
  const $http = new http();
  return $http.put({
    url: '/system/role/changeStatus',
    data,
  })
}

// 删除角色
export const $systemRoleDelete = (data: number[]) => {
  const $http = new http();
  return $http.delete({
    url: `/system/role/${data.join(',')}`,
  })
}